package cn.com.weather.nf.controller;

import cn.com.weather.nf.entity.Cctest1;
import cn.com.weather.nf.service.RunTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//@RestController
//@RequestMapping("/api")
public class RunTestController {

//    @Autowired
    private RunTestService runTestService;

    @RequestMapping(value="/hello")
    public String hello() {

        List<String> names = this.runTestService.getData();
        List<Cctest1> list = this.runTestService.getList();
        list.forEach(bean -> {
            System.out.println(bean.getId() + " : " + bean.getName());
        });

        System.out.println(
                "========="
        );

        List<Cctest1> list2 = this.runTestService.findById(1);
        list2.forEach(bean -> {
            System.out.println(bean.getId() + " : " + bean.getName());
        });
        return names.isEmpty() ? "kao" : names.get(0);
    }
}
